<?
include("session.php"); 
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../../../webkit/utils/jquery.js"></script>
<script type="text/javascript" src="../../../webkit/utils/form.checker.js"></script>
<script type="text/javascript" src="../../../webkit/datepicker/WdatePicker.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css"/> 
<body  bgcolor="#f4f4f4" style="margin:0px;" scroll=no>
<style> .input {width:150px} </style>
<hr size=1>

<table width="200px" cellspacing=1 cellpadding=3 id="basic_info_table"> 
<form name=f> 
	<tr>
		<td align=right nowrap>任务名称</td><td><input type='text' id="task_name" class='input' check='not_empty' warning='任务名称不能为空！' style="color:blue"></td>  
		<td align=right nowrap>业务类型</td><td><select id="biz_type" class='input'><option value=1>集团彩铃</option><option value=2>基地业务</option></select></td>
	</tr>
	<tr>
		<td align=right nowrap>外显号码</td><td colspan=3>
			<select id="callout_number" class='input' style="color:blue">
				<option value="4008863685">4008863685</option>
				<option value="4008863605">4008863605</option>
				<option value="4008863645">4008863645</option>
				<option value="11832811">11832811</option>
				<option value="0118114">0118114</option>
			</select>
		</td>  
	</tr>
	<tr>
		<td align=right>任务备注</td><td colspan=3><textarea style="width:430px;" rows=4 id="task_desc"></textarea></td>
	</tr>
	<input type='hidden' id="id" value="<?echo $_GET['id']?>">
</form>	
</table>

<table width=100% cellspacing=1 cellpadding=3>
	<tr>
		<td align=center>
		<hr size=1>
		<input type="button" id="btn_save" class="button" value="保存信息" onclick="save()">　　<input type="button" class="button" value="关闭窗口" onclick="parent.closeDlg()"></td>
	</tr>
</table>

<script type="text/javascript">
	var f = document.f;


	function save() { 
		if(FormChecker.doCheck(f)) {
			var params = {};
			var els = f.elements;
			for(var i=0; i<els.length; i++) {
				if(els[i].type == "button") continue;
				params[els[i].id] = els[i].value;
			}
			if(confirm('确定要保存任务信息吗？')) {
				$('#btn_save').attr('disabled', true);
				$('#btn_save').val('保存中..');
				$.post("task_query.php?action=<?echo $_GET['op']?>", params, function(data) {
					if(data.indexOf("ok") == 0) {
						alert("数据保存成功!");
						parent.refreshGrid();
						parent.closeDlg();
					} else {  
						alert(data);
					}
					$('#btn_save').attr('disabled', false);
					$('#btn_save').val('保存信息');
				});
			}
		}
	}; 

	
	function get_record_by_id(id) {
		$.get("task_query.php?action=get&id="+id, function(data){
			eval("var row = "+data);
			for(var k in row) {
				$("#"+k).val(row[k]);
			}
		})
	}


	$(function() {
		<?if($_GET['op'] == "edit") {?>
		get_record_by_id('<?echo $_GET['id']?>'); 
		<?}?>
	});
</script>
</body>
</html>